package cn.signalpha.modules.shop.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 数据传输对象实体类
 *
 * @author signalpha
 */
@Data
@ApiModel(value = "PatternGoodsDTO对象", description = "运营模式商品")
public class PatternGoodsDTO implements Serializable {
    private static final long serialVersionUID = 1L;

	@Data
	public static class SaveDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "模式id")
		private Long patternId;
		@NotNull
		@ApiModelProperty(value = "商品id")
		private Long goodsId;
		@ApiModelProperty(value = "配置")
		private String config;
	}

	@Data
	public static class UpdateDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "id")
		private Long id;
		@NotBlank
		@ApiModelProperty(value = "配置")
		private String config;
	}

	@Data
	public static class BatchSaveDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "模式id")
		private Long patternId;
		@NotBlank
		@ApiModelProperty(value = "商品id")
		private String goodsId;
		@ApiModelProperty(value = "配置")
		private BatchDistributionDTO config;
	}

	/**
	 * 分销活动配置
	 */
	@Data
	public static class DistributionDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "类型：1默认 2自定义")
		private Integer type;
		@ApiModelProperty(value = " 计算类型：1按比例 2固定金额")
		private Integer countType;
		@ApiModelProperty(value = " 规格列表")
		private List<DistributionDetailDTO> skuList;
	}
	@Data
	public static class DistributionDetailDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "规格")
		private String spec;
		@ApiModelProperty(value = "金额")
		private Double price;
		@ApiModelProperty(value = " 等级列表")
		private List<DistributionDetailLevelDTO> levelList;
	}
	@Data
	public static class DistributionDetailLevelDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "等级")
		private Integer level;
		@ApiModelProperty(value = "直推")
		private Double direct;
		@ApiModelProperty(value = "间接")
		private Double indirect;
	}

	/**
	 * 批量分销活动配置
	 */
	@Data
	public static class BatchDistributionDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "类型：1默认 2自定义")
		private Integer type;
		@ApiModelProperty(value = " 计算类型：1按比例 2固定金额")
		private Integer countType;
		@ApiModelProperty(value = " 等级列表")
		private List<DistributionDetailLevelDTO> levelList;
	}
}
